//
//  LyricsDetail.m
//  MINFOBBS
//
//  Created by juvid on 13-11-27.
//  Copyright (c) 2013年 minfo. All rights reserved.
//

#import "LyricsDetail.h"
#import "UIColor+expanded.h"
#import "DetectionSystemVersion.h"
#import "MainSearchViewController.h"
@interface LyricsDetail ()

@end

@implementation LyricsDetail

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self BackButton];
    if ([[DetectionSystemVersion alloc]Version]) {
        self.edgesForExtendedLayout=UIRectEdgeNone;
    }
//    self.labTitel.textColor= [UIColor colorWithHexString:@"0x4a4a4a"];
    self.labTitel.textColor= [UIColor blackColor];
     self.labTitel.text=[NSString stringWithFormat:@"%@(%@)",[[[[self.arrReturn objectForKey:@"Properties"] objectForKey:@"Property"]objectAtIndex:0] objectForKey:@"text"],[[[[self.arrReturn objectForKey:@"Properties"] objectForKey:@"Property"]objectAtIndex:1] objectForKey:@"text"]];
//    self.txtLyrics.textColor= [UIColor colorWithHexString:@"0x4a4a4a"];
//    self.txtLyrics.text=[[[[self.arrReturn  objectForKey:@"Properties"] objectForKey:@"Property"]objectAtIndex:2] objectForKey:@"text"];
    NSString *strContent=[[[[self.arrReturn  objectForKey:@"Properties"] objectForKey:@"Property"]objectAtIndex:2] objectForKey:@"text"];
    if (self.isSelf) {
        self.webView.hidden=YES;
        self.labContent.text=strContent;
        self.txtLyrics.hidden=YES;
    }
    else{
        self.labContent.hidden=YES;
        self.vieMore.hidden=YES;
//        self.webView.backgroundColor = [UIColor clearColor];
//        self.webView.opaque = NO;
        if (self.isMore) {
            self.webView.hidden=YES;
            self.txtLyrics.text=strContent;
//            self.txtLyrics.textColor= [UIColor colorWithHexString:@"0x1a1a1a"];

        }
        else{
            self.txtLyrics.hidden=YES;
        NSString *webviewText = @"<style>body{margin:0;background-color:transparent;color:2a2a2a;font:14px/25px Custom-Font-Name}</style>";
        webviewText = [webviewText stringByAppendingFormat:@"%@",strContent];
        [(UIScrollView *)[[self.webView subviews] objectAtIndex:0] setBounces:NO];
        [self.webView loadHTMLString:webviewText baseURL:nil]; //在 WebView 中显示本地的字符串
        }
    }
    
   
    // Do any additional setup after loading the view from its nib.
}
-(void)BackButton{
    self.navigationItem.titleView=[DetectionSystemVersion SetBarTitle:@"百事搜"];
    [self.navigationItem setHidesBackButton:YES];
    UIButton *btnBack=[[DetectionSystemVersion alloc]BackButton];
    [btnBack addTarget:self action:@selector(BackReturn:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *backItem = [[UIBarButtonItem alloc]initWithCustomView:btnBack];
    self.navigationItem.leftBarButtonItem=backItem;
    
}
#pragma mark 导航栏按钮事件
-(void)BackReturn:(id)sender{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (MainSearchViewController *)menuContainerViewController {
    return (MainSearchViewController *)self.parentViewController;
}
- (IBAction)PressMore:(id)sender {
    LyricsDetail *jokecon=[[LyricsDetail alloc]init];
    jokecon.arrReturn=self.arrReturn;
    jokecon.isMore=YES;
    [ [self menuContainerViewController].navigationController  pushViewController:jokecon animated:YES];
}
@end
